#! /usr/bin/python

import math
import time

tt = time.time()
pre = [1, 1]

count = 0
row = 2
while(row < 49):
    next = [1]
    for col in range(len(pre) - 1):
	item = pre[col] + pre[col + 1]
	next.append(item%7)
    next.append(1)
    pre = next
    #print next, row+1
    count += next.count(0)
    row += 1

unit = 784
base = 49
print 49 * (49 + 1)/2 - count

ss = unit
pairs = [0, 28, 784]
for power in range(3, 11):
     unit *= 28
     pairs.append(unit)
     power += 1
     
print pairs
unit *= 6

diff = 10**9 - (3*7**10 + 3*7**9 + 5*7**8 + 3*7**7 + 7**6 + 6*7**5 + 6*7**2 + 7 + 6)
print diff
print 6*pairs[10] + 4*(6*pairs[9] + 4*(15*pairs[8] + 6*(6*pairs[7] + 4*(pairs[6] + 2*(21*pairs[5] + 7*(21*pairs[2] + 7*(pairs[1] + 2*21)))))))

print 3*pairs[3] + 3*(21*pairs[2] + 7*(3*pairs[1] +3*21)) - 118335
print time.time() - tt

285714288285714288
285714287285714287
